/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.wins.vertx.entity;

import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;

/**
 * Converter for {@link io.wins.vertx.entity.Seat}.
 *
 * NOTE: This class has been automatically generated from the {@link io.wins.vertx.entity.Seat} original class using Vert.x codegen.
 */
public class SeatConverter {

  public static void fromJson(JsonObject json, Seat obj) {
    if (json.getValue("columns") instanceof Number) {
      obj.setColumns(((Number)json.getValue("columns")).intValue());
    }
    if (json.getValue("createdOn") instanceof Number) {
      obj.setCreatedOn(((Number)json.getValue("createdOn")).longValue());
    }
    if (json.getValue("delete") instanceof Boolean) {
      obj.setDelete((Boolean)json.getValue("delete"));
    }
    if (json.getValue("legend") instanceof String) {
      obj.setLegend((String)json.getValue("legend"));
    }
    if (json.getValue("maps") instanceof String) {
      obj.setMaps((String)json.getValue("maps"));
    }
    if (json.getValue("name") instanceof String) {
      obj.setName((String)json.getValue("name"));
    }
    if (json.getValue("rows") instanceof Number) {
      obj.setRows(((Number)json.getValue("rows")).intValue());
    }
    if (json.getValue("seats") instanceof String) {
      obj.setSeats((String)json.getValue("seats"));
    }
    if (json.getValue("unavailables") instanceof String) {
      obj.setUnavailables((String)json.getValue("unavailables"));
    }
    if (json.getValue("updatedOn") instanceof Number) {
      obj.setUpdatedOn(((Number)json.getValue("updatedOn")).longValue());
    }
  }

  public static void toJson(Seat obj, JsonObject json) {
    json.put("columns", obj.getColumns());
    json.put("createdOn", obj.getCreatedOn());
    json.put("delete", obj.isDelete());
    if (obj.getId() != null) {
      json.put("id", obj.getId());
    }
    if (obj.getLegend() != null) {
      json.put("legend", obj.getLegend());
    }
    if (obj.getMaps() != null) {
      json.put("maps", obj.getMaps());
    }
    if (obj.getName() != null) {
      json.put("name", obj.getName());
    }
    json.put("rows", obj.getRows());
    if (obj.getSeats() != null) {
      json.put("seats", obj.getSeats());
    }
    if (obj.getUnavailables() != null) {
      json.put("unavailables", obj.getUnavailables());
    }
    json.put("updatedOn", obj.getUpdatedOn());
  }
}